<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改课程信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-course-edit" th:object="${yyCourse}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">课程名称：</label>
                <div class="col-sm-8">
                    <input name="courseName" th:field="*{courseName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">授课老师：</label>
                <div class="col-sm-8">
                    <input name="teaId" class="form-control" type="hidden">
                </div>
                <div class="col-sm-8">
                    <select id="teaId" class="form-control select2-multiple">
                        <option th:each="tea:${tea}" th:value="${tea.id}" th:text="${tea.teaName}" th:selected="${tea.flag}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学分：</label>
                <div class="col-sm-8">
                    <input name="stuScore" th:field="*{stuScore}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学期：</label>
                <div class="col-sm-8">
                    <input name="semester" th:field="*{semester}" class="form-control" type="text" required>
                </div>
            </div>
    <!--        <div class="form-group">
                <label class="col-sm-3 control-label is-required">课程简介：</label>
                <div class="col-sm-8">
                    <textarea name="courseIntro" class="form-control" required>[[*{courseIntro}]]</textarea>
                </div>
            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/course";
        $("#form-course-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            // 获取所选下拉框的值
            var selectedteaId = $('#teaId').val();
            // 将所选值赋给隐藏的输入文本框
            $('input[name="teaId"]').val(selectedteaId);
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-course-edit').serialize());
            }
        }
    </script>
</body>
</html>
